package pe.intix.drawback.formatters

import javax.servlet.http.*

import org.openxava.formatters.*;

/**
 * @author Jeromy Altuna
 * 
 */
class FillLeadingZerosFormatter implements IFormatter {
	
	int size
	
	String format(HttpServletRequest request, Object string) {
		if(string == null) return ""
		String.format("%1\$${size}s", (String)string).replace(' ', '0')		
	}

	Object parse(HttpServletRequest request, String string) {
		return string.toString()
	}	
}
